package com.koron.sinoprobe.web.engineering.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.sinoprobe.web.engineering.bean.po.SpWarrantyConstruction;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * 质保期满验收-施工单位(SpWarrantyConstruction)表服务接口
 *
 * @author jzp
 * @since 2022-03-03 09:22:00
 */
public interface SpWarrantyConstructionService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    SpWarrantyConstruction getById(SessionFactory factory, String id);

    /**
     * 查询所有数据
     *
     * @param spWarrantyConstruction 查询条件对象
     * @return 列表结果集
     */
    List<SpWarrantyConstruction> list(SessionFactory factory, SpWarrantyConstruction spWarrantyConstruction);

    /**
     * 分页查询
     *
     * @param spWarrantyConstruction 分页条件
     * @return 对象列表
     */
    default PageInfo<SpWarrantyConstruction> page(SessionFactory factory, PageQuery pageQuery, SpWarrantyConstruction spWarrantyConstruction) {
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<SpWarrantyConstruction> spWarrantyConstructionList = list(factory, spWarrantyConstruction);
        return new PageInfo<>(spWarrantyConstructionList);
    }

    List<SpWarrantyConstruction> listByWarrantyId(SessionFactory factory, String warrantyId);

    /**
     * 新增数据
     *
     * @param spWarrantyConstruction 实例对象
     * @return 是否成功
     */
    boolean save(SessionFactory factory, SpWarrantyConstruction spWarrantyConstruction);

    boolean saveBatch(SessionFactory factory, List<SpWarrantyConstruction> lists);

    /**
     * 修改数据
     *
     * @param spWarrantyConstruction 实例对象
     * @return 是否成功
     */
    boolean update(SessionFactory factory, SpWarrantyConstruction spWarrantyConstruction);

    boolean deleteBatchIds(SessionFactory factory, List<String> ids);

    boolean removeByWarrantyId(SessionFactory factory, String appceptId);
}
